/**！
 * http请求底层类封装
 */

import request from "./request";
import { baseURL, staticURL } from "@/utility/const";

export default new (class {
  constructor() {
    this.baseURL = baseURL;
    this.staticURL = staticURL;
    this.uploadURL = `${baseURL}/xcx/common/upload`;
  }

  get(uri, params) {
    return request.get(`${this.baseURL}${uri}`, { params });
  }

  post(uri, params) {
    return request.post(`${this.baseURL}${uri}`, params);
  }
  delete(uri, params) {
    return request.delete(`${this.baseURL}${uri}`, params);
  }

  // //获取所有落地页数据
  // getAllPage(params) {
  //   return this.post("/getAllPage", params);
  // }
  getAllPage(params) {
    return this.get("/business/hairLandpage/list", params);
  }

  //获取指定落地页数据
  // getPage(params) {
  //   return this.post("/getPage", params);
  // }
  getPage(params) {
    return this.get("/business/hairLandpage/" + params.id);
  }

  //新建落地页数据 /business/hairLandpage/submit
  // createPage(params){
  //     return this.post('/createPage', params)
  // }

  //新建落地页数据 /business/hairLandpage/submit
  createPage(params) {
    return this.post("/business/hairLandpage/submit", params);
  }

  //编辑保存落地页数据
  savePage(params) {
    return this.post("/savePage", params);
  }

  //逻辑删除落地页
  deletePage(params) {
    return this.delete("/business/hairLandpage/" + params.id);
  }

  //更新落地页状态
  updatePageStatus(params) {
    return this.post("/updatePageStatus", params);
  }
})();
